fix: include git2/sys/alloc.h for git_allocator on libgit2 1.8+#512
fix: include git2/sys/alloc.h for git_allocator on libgit2 1.8+#512eejd wants to merge 1 commit into
Conversation
git_allocator moved out of the top-level git2.h into git2/sys/alloc.h in libgit2 1.8.0. Add an explicit include so the mimalloc binding compiles against libgit2 >= 1.8 (e.g. MacPorts libgit2 1.9.4).
|
Thanks @eejd — the |
This resolves build failures against libgit2 >= 1.8.0.
Co-authored-by: @eejd (based on pending PR DeusData#512)
|
Thanks for the libgit2 compatibility fix. Before review can continue, please add a DCO |
|
Confirming this fix on another environment — thanks for putting it up. Repro (macOS arm64, Homebrew libgit2 1.9.4): On libgit2 1.9.4, So this reproduces beyond 1.8+ (also on 1.9.4), and the fix is correct. It looks merge-ready aside from the DCO |
|
Thank you for finding and reporting this first — you identified the missing include a full 11 days before anyone else, and that diagnosis is what ultimately got it fixed. We've merged the same fix via #722 (merge efad17d), which was in a mergeable state with a passing DCO check; since the sign-off here never came through and the branch went quiet, we're closing this one as a duplicate rather than leaving it open. The first-finder credit is yours — thanks again for the sharp catch, and we'd be happy to see more contributions from you. |
Problem
git_allocatorwas moved from the top-levelgit2.hintogit2/sys/alloc.hin libgit2 1.8.0. Building
codebase-memory-mcpagainst libgit2 ≥ 1.8 fails:Fix
Add an explicit
#include <git2/sys/alloc.h>immediately after#include <git2.h>inside theHAVE_LIBGIT2guard ininternal/cbm/cbm.c. The struct members (gmalloc,grealloc,gfree)and the
GIT_OPT_SET_ALLOCATORoption code are unchanged — the onlyissue was the missing header.
Tested against
🤖 Generated with Claude Code